package ZuoYe3_whileXunHuan_0420;

import java.util.Scanner;

public class ZuoYe12_GouWuJieSuan {

	public static void main(String[] args) {
		// ppt上最后 ,购物结算那题,折扣统一是8折
		Scanner input = new Scanner(System.in);
		System.out.println(
				"*************************************************\n请选择购买的商品编号：1、T恤\t2、网球鞋\t3、网球拍\n*************************************************");
		int tXun = 0, qiuXie = 0, qiuPai = 0;
		double tXunPri = 100, qiuXiePri = 200, qiuPaiPri = 300, sum = 0;
		String flag;
		do {
			System.out.print("请输入商品编号：");
			int num = input.nextInt();

			System.out.print("请输入购买数量：");
			int num2 = input.nextInt();
			if (num == 1) {
				System.out.println("T恤￥" + tXunPri + "\t数量:" + num2 + "合计￥" + (tXunPri * num2));
				sum += tXunPri * num2;
			} else if (num == 2) {
				System.out.println("网球鞋￥" + qiuXiePri + "\t数量:" + num2 + "合计￥" + (qiuXiePri * num2));
				sum += qiuXiePri * num2;
			} else if (num == 3) {
				System.out.println("网球拍￥" + qiuPaiPri + "\t数量:" + num2 + "合计￥" + (qiuPaiPri * num2));
				sum += qiuPaiPri * num2;
			} else {
				System.out.println("输入错误，无该商品编号！");
			}

			System.out.print("是否继续(y/n)");
			flag = input.next();

		} while (!flag.equals("n"));

		System.out.println("折扣：0.8\n应付金额：" + (sum = sum * 0.8));
		System.out.print("请输入实付金额：");
		double money = input.nextDouble();
		System.out.println("找钱：" + (money - sum));
	}

}
